home *** CD-ROM | disk | FTP | other *** search
/ Aminet 50 / Aminet 50 (2002)(GTI - Schatztruhe)[!][Aug 2002].iso / Aminet / util / moni / LAlert.lha / LAlert / LAlert.s < prev    next >
Text File  |  2002-05-07  |  6KB  |  186 lines

  1. *****************************************************************************
  2. *                                        *
  3. *    PROGRAM: LAlert (LastAlert)                        *
  4. *    VERSION: 1.0                                *
  5. *   SOURCE CODE: 7                                *
  6. *       DATE: 3.5.2002                            *
  7. *      LANGUAGE: Assembler (DevPac V3.14)                    *
  8. *     SYSTEM: A1200    KS 40.68 WB 40.42 2MB chip 64MB fast 68030/50mhz    *
  9. *                                        *
  10. *     AUTHOR: Joerg Riemer 14167 Berlin/SchottmuellerStr.107/Germany        *
  11. *      EMAIL: joerg_riemer@freenet.de / mission@cs.tu-berlin.de         *
  12. *                                        *
  13. *    COMMENT: displays the GURU's last meditation number            *
  14. *                                        *
  15. *         getting information about the last alert is a bit        *
  16. *         tricky. because both, the guru-number and the address         *
  17. *         where it happened, only stored at the zero-page.        *
  18. *         both values are survive any reset as long as the        *
  19. *         machine is not switched off. but due to the fact,        *
  20. *         many programming errors cause invalid access to these        *
  21. *         addresses, this memory is marked as invalid by the        *
  22. *         enforcer. LAlert reads both longwords by an enforcer        *
  23. *         friendly way. just a tiny blitter operation is used        *
  24. *         to avoid any hit. the blitter copys both longwords to        *
  25. *         a readable area from where they will printed to the        *
  26. *         current output.                        *
  27. *                                        *
  28. *    KNOWN BUGS: hmm?... LAlert is much short to make relevant mistakes.    *
  29. *                                        *
  30. *         LAlert is available at AmiNet util/moni/...            *
  31. *                                        *
  32. *         for suggestions, hints/tips, and/or questions,            *
  33. *         send an email! (see above for address)                *
  34. *                                        *
  35. *****************************************************************************
  36.  
  37. _custom    equ    $00DFF000
  38.  
  39. bltcon0    equ    $00000040
  40. bltcon1    equ    $00000042
  41. bltdpt    equ    $00000054
  42. bltbpt    equ    $0000004C
  43. bltapt    equ    $00000050
  44. bltafwm    equ    $00000044
  45. bltbmod    equ    $00000062
  46. bltamod    equ    $00000064
  47. bltcdat    equ    $00000070
  48. bltsize    equ    $00000058
  49. bltdmod    equ    $00000066
  50.  
  51. *****************************************************************************
  52.  
  53. _LVOAllocMem              equ    -198
  54. _LVOFreeMem                equ    -210
  55. _LVOCloseLibrary           equ    -414
  56. _LVOOpenLibrary            equ    -552
  57.  
  58. *****************************************************************************
  59.  
  60. _LVOOwnBlitter        equ    -456
  61. _LVODisownBlitter    equ    -462
  62. _LVOWaitBlit        equ    -228
  63.  
  64. *****************************************************************************
  65.  
  66. _LVOVPrintf        equ    -954
  67.  
  68. *****************************************************************************
  69.  
  70. OpenLibs    movea.l    4.w,A6            ;set EXEC to call a function
  71.  
  72.         moveq    #37,D0            ;set version number
  73.         lea    _DOSName(pc),A1        ;set library name
  74.         lea    _DOSBase(pc),A2        ;set buffer for base
  75.         jsr    _LVOOpenLibrary(A6)    ;use EXEC to (openlibrary)
  76.         move.l    D0,(A2)            ;save base
  77.  
  78.         beq.b    CloseLibs        ;no dosbase returned; quit
  79.  
  80.         moveq    #00,D0            ;set version number
  81.         lea    _GFXName(pc),A1        ;set library name
  82.         lea    _GFXBase(pc),A2        ;set buffer for base
  83.         jsr    _LVOOpenLibrary(A6)    ;use EXEC to (openlibrary)
  84.         move.l    D0,(A2)            ;save base
  85.  
  86.         beq.b    CloseLibs        ;no gfxbase returned; quit
  87.  
  88. *****************************************************************************
  89.  
  90.         bsr.b    Main            ;go mainpart
  91.  
  92. *****************************************************************************
  93.  
  94. CloseLibs    movea.l    4.w,A6            ;set EXEC to call a function
  95.  
  96.         move.l    _GFXBase(pc),D1        ;get gfxbase
  97.         beq.b    .skip            ;branch if not open
  98.         movea.l    D1,A1            ;set gfxbase
  99.         jsr    _LVOCloseLibrary(A6)    ;use EXEC to (closelibrary)
  100.  
  101. .skip        move.l    _DOSBase(pc),D1        ;get dosbase
  102.         beq.b    .quit            ;branch if not open
  103.         movea.l    D1,A1            ;set dosbase
  104.         jsr    _LVOCloseLibrary(A6)    ;use EXEC to (closelibrary)
  105.  
  106. .quit        rts                ;go back (quit program)
  107.  
  108. *****************************************************************************
  109.  
  110. _DOSBase    dc.l    0
  111. _GFXBase    dc.l    0
  112.  
  113. *****************************************************************************
  114.  
  115. _DOSName    dc.b    "dos.library",0
  116. _GFXName    dc.b    "graphics.library",0
  117.  
  118. *****************************************************************************
  119.  
  120.     dc.b "$VER: LAlert 1.0 7 (3.5.2002) by joerg riemer may'02",0
  121.  
  122. *****************************************************************************
  123.  
  124.         cnop    0,4
  125.  
  126. ************************************************ alloc a bit memory *********
  127.  
  128. Main        moveq    #8,D0            ;required size of memory
  129.         moveq    #2,D1            ;chip memory, please!
  130.         movea.l    4.w,A6            ;set EXEC to call a function
  131.         jsr    _LVOAllocMem(A6)    ;use EXEC for (AllocMem)
  132.         tst.l    D0            ;got some memory ?
  133.         beq.b    .quit            ;NO?, isn't that realistic?!?
  134.  
  135. ************************************************ read zero-page ($100,$104) *
  136.  
  137.         movea.l    D0,A2            ;set memory_base
  138.  
  139.         movea.l    _GFXBase(pc),A6        ;set GFX to call a function
  140.         jsr    _LVOOwnBlitter(A6)    ;use GFX to (OwnBlitter)
  141.         jsr    _LVOWaitBlit(A6)    ;wait for blitter finished
  142.  
  143.         lea    _custom,A5        ;set custom_base
  144.         move.l    A2,bltdpt(A5)        ;set destination memory
  145.         moveq    #0,D0
  146.         move.l    D0,bltamod(A5)        ;set blitter modulo (source)
  147.         move.w    #$100,D0        ;get source (z-page $100)
  148.         move.l    D0,bltapt(A5)        ;set source memory
  149.         moveq    #-1,D0
  150.         move.l    D0,bltafwm(A5)        ;set blitter mask (source)
  151.         move.l    #$9F00000,bltcon0(A5)    ;set blitter control 1+2
  152.         move.w    #$44,bltsize(A5)    ;set size and start operation
  153.  
  154.         jsr    _LVOWaitBlit(A6)    ;wait for blitter finished
  155.         jsr    _LVODisownBlitter(A6)    ;thanks a lot, no more blits!
  156.  
  157. ************************************************ guru available? ************
  158.  
  159.         moveq    #-1,D0            ;prepare register
  160.         cmp.l    (A2),D0            ;any meditation available?
  161.         beq.b    .quit            ;no, quit in silence
  162.  
  163. ************************************************ print some information *****
  164.  
  165.         lea    Info(pc),A1        ;get text "The GURU's..."
  166.         move.l    A1,D1            ;set text ...
  167.         move.l    A2,D2            ;set array
  168.  
  169.         movea.l    _DOSBase(pc),A6        ;set DOS to call a function
  170.         jsr    _LVOVPrintf(A6)        ;use DOS to (vprintf) text
  171.  
  172. ************************************************ free memory ****************
  173.  
  174.         movea.l    A2,A1            ;set memory_base
  175.         moveq    #8,D0            ;set size
  176.         movea.l    4.w,A6            ;use EXEC to call a function
  177.         jsr    _LVOFreeMem(A6)        ;use EXEc to (freemem)
  178.  
  179. .quit        rts                ;go back
  180.  
  181. *****************************************************************************
  182.  
  183. Info    dc.b    $A,"The GURU's last meditation: $%08lx.$%08lx",$A,$A,0
  184.  
  185.  end of source **************************************************************
  186.